import { request } from "@umijs/max";

export async function getAccountInfo(options?: { [key: string]: any },
) {
    return request<Account.AcountInfo>(`/api/account/info`, {
        method: 'GET',
        ...(options || {}),
    });
}

export async function getAccountResources(options?: { [key: string]: any },
) {
    return request<[string, string][]>(`/api/account/resource`, {
        method: 'GET',
        ...(options || {}),
    });
}

export async function updateAccountInfo(
    data: Account.AcountUpdateDo,
    options?: { [key: string]: any },
) {
    return request(`/api/account/info`, {
        method: 'PUT',
        ...(options || {}),
        data
    });
}

export async function updateAccountAvatar(
    avatar: string,
    options?: { [key: string]: any },
) {
    return request(`/api/account/info`, {
        method: 'PUT',
        ...(options || {}),
        data: { avatar }
    });
}